package easy;

import java.util.ArrayList;
import java.util.List;

public class Solution_1441 {

    public List<String> buildArray(int[] target, int n) {
        List<String> list = new ArrayList<>();
        for (int i = 1, index = 0; index < target.length && i <= n; i++) {
            if (i == target[index]) {
                list.add("Push");
                index++;
            } else if (i < target[index]) {
                list.add("Push");
                list.add("Pop");
            }
        }
        return list;
    }

    public static void main(String[] args) {
        Solution_1441 model = new Solution_1441();
        System.out.println(model.buildArray(new int[]{2, 3, 4, 5, 8, 9, 10}, 10));
        System.out.println(model.buildArray(new int[]{1, 3}, 3));
        System.out.println(model.buildArray(new int[]{1, 2, 3}, 3));
        System.out.println(model.buildArray(new int[]{1, 2}, 4));
        System.out.println(model.buildArray(new int[]{2, 3, 4}, 4));
    }
}
